"""Celery application configuration."""
from celery import Celery
from config import config

def make_celery(config_name='default'):
    """Create Celery application.
    
    Args:
        config_name: Configuration name
        
    Returns:
        Configured Celery instance
    """
    cfg = config[config_name]
    
    celery = Celery(
        'buyu',
        broker=cfg.CELERY_BROKER_URL,
        backend=cfg.CELERY_RESULT_BACKEND,
        include=['app.tasks.music_tasks']  # Auto-discover tasks
    )
    
    celery.conf.update(
        task_serializer='json',
        accept_content=['json'],
        result_serializer='json',
        timezone='UTC',
        enable_utc=True,
    )
    
    return celery

celery = make_celery()
